package com.milhouz.quizzdroid.bean;

public class Score {

	int nbQuestions = 0;
	int nbCorrectResponses = 0;
	float meanTimeResponseMs = 0;

	public void addNbQuestions() {
		nbQuestions++;
	}

	public void addCorrectResponses() {
		nbCorrectResponses++;
	}

	public int getNbQuestions() {
		return nbQuestions;
	}

	public int getNbCorrectResponses() {
		return nbCorrectResponses;
	}

	public float getMeanTimeResponseMs() {
		return meanTimeResponseMs;
	}

	public float getMeanTimeResponseSec() {
		return meanTimeResponseMs / 1000;
	}

	public void addResponseTime(final float responseTime) {
		if (meanTimeResponseMs == 0) {
			meanTimeResponseMs = responseTime;
		} else {
			meanTimeResponseMs = (meanTimeResponseMs + responseTime) / 2;
		}
	}

}
